package com.base.cn.platform.os.service.manage.user.binding;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.Map;

/**
 * 手机号或邮箱号绑定Service接口
 *
 * @author s.li
 * @create 2018-06-05-16:26
 */
@FeignClient(name = BaseService.appName,configuration = FeignAuthConfig.class)
public interface UserMobileOrEmailBindingService extends BaseService {

    /**
     * 验证原绑定的手机号(如果没有绑定过的手机号，将用不到该接口)
     * @param mobile 手机号
     * @param mobileCode 手机验证码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/user/verificationOldMobile")
    Map<String,Object> verificationOldMobile(@RequestParam("mobile") String mobile,
                                             @RequestParam("mobileCode") String mobileCode);

    /**
     * 绑定手机号
     * @param userId 用户ID
     * @param mobile 新的手机号
     * @param mobileCode 新手机号的验证码
     * @param oldMobileCode 原手机号的验证码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/user/bindingUserMobile")
    Map<String,Object> bindingUserMobile(@RequestParam("userId") BigDecimal userId,
                                         @RequestParam("mobile") String mobile,
                                         @RequestParam("mobileCode") String mobileCode,
                                         @RequestParam(value = "oldMobileCode", required = false) String oldMobileCode);

    /**
     * 验证原绑定的邮箱号(如果没有绑定过的邮箱号，将用不到该接口)
     * @param email 邮箱号
     * @param emailCode 邮箱验证码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/user/verificationOldEmail")
    Map<String,Object> verificationOldEmail(@RequestParam("email") String email,
                                            @RequestParam("mobileCode") String emailCode);

    /**
     * 绑定邮箱号
     * @param userId 用户ID
     * @param email 新的邮箱号
     * @param emailCode 新邮箱号的验证码
     * @param oldEmailCode 原邮箱号的验证码
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/user/bindingUserEmail")
    Map<String,Object> bindingUserEmail(@RequestParam("userId") BigDecimal userId,
                                        @RequestParam("email") String email,
                                        @RequestParam("emailCode") String emailCode,
                                        @RequestParam(value = "oldEmailCode", required = false) String oldEmailCode);
}
